<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./jQuery.min.js"></script>
</head>

<body>
    <div class="test-selector">
        <ul class="test-lang">
            <li class="lang-javascript">JavaScript</li>
            <li class="lang-python">Python</li>
            <li class="lang-lua">Lua</li>
        </ul>
        <ol class="test-lang">
            <li class="lang-swift">Swift</li>
            <li class="lang-java">Java</li>
            <li class="lang-c">C</li>
        </ol>
    </div>
    <script>
        'use strict';
        var selected = null;
        //选择所有语言(属性选择器)
        selected = $("[class^='lang-']");
        console.log(selected);
        //选择所有动态语言
        selected = $("ul.test-lang li");
        console.log(selected);
        //选择所有静态语言
        selected = $("ol.test-lang li");
        console.log(selected);
        //选择JavaScript
        selected = $("ul.test-lang li:first-child");
        console.log(selected);
        //选择lua
        selected = $("ul.test-lang li:nth-child(3)");
        console.log(selected);
        //选择C
        selected = $("ol.test-lang li:nth-child(3)")
        console.log(selected);
    </script>
</body>

</html>